<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
		<title>出入平安，招财进宝</title>
		<link rel="stylesheet" type="text/css" href="./css/comment.css" />
		<link rel="stylesheet" type="text/css" href="./css/carProduct.css" />
		<script type="text/javascript" src="./js/rem.js"></script>
		<script type="text/javascript" src="./js/cookie.js"></script>
		<script type="text/javascript">
			// 获取url参数
			function GetQueryString(name){
				var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if(r!=null)return  unescape(r[2]); return null;
			}
			// 获取相关信息
			var whereFrom = GetQueryString("from");// 来源
			var phone = GetQueryString("fromPhone");// 手机
			var _Global_;// 全局来源
			//兼容微信分享出去自带from query的冲突 singlemessage groupmessage timeline 分别对应 单人分享 微信群分享 朋友圈分享
			if (whereFrom == null || whereFrom == '' || whereFrom == 'null'|| whereFrom=='singlemessage' || whereFrom=='groupmessage' || whereFrom=='timeline') {
				_Global_ = 'web';
			} else {
				_Global_ = 'app';
				// 设置cookie 在分会场内取出使用
				setCookie('phone',phone);
			}
			// 设置cookie 在分会场内取出使用
			setCookie('siteFrom',_Global_);
		</script>
	</head>

	<body>
		<div class="treasure">
			<div class="treasureHead">
				<img src="./image/carProduct/subject.jpg" alt="" />
			</div>
			<div class="carpField">
				<div class="carpTitle">
					<img src="./image/carProduct/title.jpg" alt="" />
				</div>
				<div class="carpLists">
					<div class="carpList1">
						<img src="./image/carProduct/p1.png" alt="" onclick="H5AppOpen('651673')" />
					</div>
					<div class="carpList2">
						<img src="./image/carProduct/p2.png" alt="" onclick="H5AppOpen('651674')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList3">
						<img src="./image/carProduct/p3.png" alt="" onclick="H5AppOpen('651675')" />
					</div>
					<div class="carpList4">
						<img src="./image/carProduct/p4.png" alt="" onclick="H5AppOpen('651676')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList5">
						<img src="./image/carProduct/p5.png" alt="" onclick="H5AppOpen('651677')" />
					</div>
					<div class="carpList6">
						<img src="./image/carProduct/p6.png" alt="" onclick="H5AppOpen('651679')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList7">
						<img src="./image/carProduct/p7.png" alt="" onclick="H5AppOpen('651678')" />
					</div>
					<div class="carpList8">
						<img src="./image/carProduct/p8.png" alt="" onclick="H5AppOpen('701285')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList9">
						<img src="./image/carProduct/p9.png" alt="" onclick="H5AppOpen('651681')" />
					</div>
					<div class="carpList10">
						<img src="./image/carProduct/p10.png" alt="" onclick="H5AppOpen('651682')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList11">
						<img src="./image/carProduct/p11.png" alt="" onclick="H5AppOpen('651683')" />
					</div>
					<div class="carpList12">
						<img src="./image/carProduct/p12.png" alt="" onclick="H5AppOpen('651684')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList13">
						<img src="./image/carProduct/p13.png" alt="" onclick="H5AppOpen('651685')" />
					</div>
					<div class="carpList14">
						<img src="./image/carProduct/p14.png" alt="" onclick="H5AppOpen('651693')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList15">
						<img src="./image/carProduct/p15.png" alt="" onclick="H5AppOpen('651687')" />
					</div>
					<div class="carpList16">
						<img src="./image/carProduct/p16.png" alt="" onclick="H5AppOpen('651688')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList17">
						<img src="./image/carProduct/p17.png" alt="" onclick="H5AppOpen('651689')" />
					</div>
					<div class="carpList18">
						<img src="./image/carProduct/p18.png" alt="" onclick="H5AppOpen('651690')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList19">
						<img src="./image/carProduct/p19.png" alt="" onclick="H5AppOpen('651691')" />
					</div>
					<div class="carpList20">
						<img src="./image/carProduct/p20.png" alt="" onclick="H5AppOpen('651692')" />
					</div>
				</div>
				<div class="carpLists">
					<div class="carpList21">
						<img src="./image/carProduct/p21.png" alt="" onclick="H5AppOpen('651686')" />
					</div>
					<div class="carpList22">
						<img src="./image/carProduct/p22.png" alt="" onclick="H5AppOpen('651694')" />
					</div>
				</div>
			</div>
			<div class="treasureGive" onclick="H5AppOpen('651680')">
				<img src="./image/carProduct/give.png" alt="" />
			</div>
			<div class="carpFooter">
				<img src="./image/carProduct/footer.png" alt="" />
			</div>
		</div>
		<!-- 回顶部 -->
		<div class="goTop">
			<img src="./image/carProduct/top.png" id="gotop" alt="">
		</div>
	</body>

</html>
<script src="http://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="./js/H5AppOpen.js"></script>
<script src="./js/comment.js"></script>
<script type="text/javascript">
	//返回顶部
	$(window).scroll(function() {
		var VscrollTop = $("body").scrollTop();
		if(VscrollTop > 1500) {
			$("#gotop").show();
		} else {
			$("#gotop").hide();
		}
	})
	$("#gotop").click(function() {
		$("body").scrollTop(0);
	})
	// ----------------------------------------------------------------- 以下是分享部分
	//分享记录
	function saveRecord(actId, type) {
		var json = {
			'ACT_ID': actId,
			'SHARE_TYPE': type,
			'MOBILE': _Global_ == 'web' ? getCookie('userName') : phone
		}
		$.ajax({
			type: "post",
			async: false,
			dataType: "json",
			url: getIp + "/CARNT/Act/createShareRecord.action",
			data: json,
			success: function() {}
		});
	}
	// 点击数
	var json = {
		'actId': 20171104
	}

	$.ajax({
		type: "post",
		async: false,
		dataType: "json",
		url: getIp + "/CARNT/Act/updateActClick.action",
		data: json,
		success: function(data) {
			//slert("ok");
		}
	})
	var title;
	var desc;
	var imgUrl;
	var linkUrl;
	//分享文案
	$.ajax({
		type: "post",
		async: false,
		dataType: "json",
		url: getIp + "/CARNT/ActWeb/getActivityById.action",
		data: {
			ACT_ID: '20171104'
		},
		success: function(data) {
			title = data.RESULT_DATA[0].SHARE_TITLE;
			desc = data.RESULT_DATA[0].SHARE_CONTENT;
			imgUrl = data.RESULT_DATA[0].SHARE_ICON;
			linkUrl = data.RESULT_DATA[0].LINK_URL;
			document.title = title;
		}
	});
	//获取分享的文案
	var timestamp;
	var nonceStr;
	var signature;
	//这个URL是你当前页面的url
	var json = {
		'url': location.href
	}
	var u = navigator.userAgent;
	var isAndroids = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
	var isiOSs = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
	var urls='';
	var appid='';
	if(isAndroids){
		urls='../../OAuth/getAccess_token.action';
		appid='wxf71262a112685c25';
	}else if(isiOSs){
		urls='../../OAuth/getAccess_tokenIPHONE.action';
		appid='wx054c6f61cacfa911';
	}
	$.ajax({
		type: "post",
		async: false,
		dataType: "json",
		url: urls,
		data: json,
		success: function(data) {
			timestamp = data.NOW_TIME;
			nonceStr = data.NONCESTR;
			signature = data.SKEY;
			wx.config({
				debug: false, // 开启调试模式,false调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: appid, // 必填，公众号的唯一标识
				timestamp: timestamp, // 必填，生成签名的时间戳
				nonceStr: nonceStr, // 必填，生成签名的随机串
				signature: signature, // 必填，签名，见附录1
				jsApiList: [
					'onMenuShareTimeline',
					'onMenuShareAppMessage',
					'hideOptionMenu',
					'showOptionMenu'
				]
			});
		}
	});
	wx.ready(function() {

		// 分享给朋友
		wx.onMenuShareAppMessage({
			title: title,
			desc: desc,
			link: linkUrl,
			imgUrl: imgUrl,
			trigger: function(res) {},
			success: function(res) {
				saveRecord(20171104, 1);
			},
			cancel: function(res) {},
			fail: function(res) {
				alert(JSON.stringify(res));
			}
		});

		//分享朋友圈
		wx.onMenuShareTimeline({
			title: title,
			desc: desc,
			link: linkUrl,
			imgUrl: imgUrl,
			trigger: function(res) {

			},
			success: function(res) {
				saveRecord(20171104, 1);
			},
			cancel: function(res) {},
			fail: function(res) {
				alert(JSON.stringify(res));
			}
		});
	});
</script>